<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    window.onload=function(){
        var oDiv =document.createElement('div');
        oDiv.setAttribute('id','example');

        document.body.appendChild(oDiv);

        var oP=document.createElement('p');

        oP.innerHTML='淘，我喜欢。';
        oP.setAttribute('class','slogan');
        oDiv.appendChild(oP);
    }
</script>
</body>
</html>